class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

h = A("h")
l = B("l")
b = C("b")
f = D("f")
e = E("e")
j = D("j")
i = E("i")
a = C("a")
g = A("g")

h.z = g
h.v = a
l.o = f
l.x = a
b.t = a
b.v = a
b.w = h
f.r = h
f.u = h
e.x = i
j.r = h
j.u = h
i.x = e
a.t = b
a.v = b
a.w = h
g.z = h
g.v = b
assert j.r.v.t.t.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: A = None
        self.v: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

h = A("h")
l = B("l")
b = C("b")
f = D("f")
e = E("e")
j = D("j")
i = E("i")
a = C("a")
g = A("g")

h.z = g
h.v = a
l.o = f
l.x = a
b.t = a
b.v = a
b.w = h
f.r = h
f.u = h
e.x = i
j.r = h
j.u = h
i.x = e
a.t = b
a.v = b
a.w = h
g.z = h
g.v = b
assert j.r.v.t.t.w.z.txt == "g"