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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: D = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: A = None
        self.p: F = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: C = None
        self.z: A = None
        self.u: C = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: E = None
        self.q: C = None
        self.u: C = None
        self.txt = txt

h = A("h")
g = B("g")
e = C("e")
i = D("i")
k = E("k")
j = F("j")
l = D("l")

h.x = k
g.z = j
e.y = k
e.r = i
e.v = g
i.w = l
i.x = h
i.p = j
i.o = e
k.y = h
k.z = h
k.p = e
k.u = e
k.x = j
j.w = g
j.x = k
j.q = e
j.u = e
l.w = i
l.x = h
l.p = j
l.o = e
assert g.z.u.r.p.w.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: D = None
        self.v: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: A = None
        self.p: F = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: C = None
        self.z: A = None
        self.u: C = None
        self.x: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: E = None
        self.q: C = None
        self.u: C = None
        self.txt = txt

h = A("h")
g = B("g")
e = C("e")
i = D("i")
k = E("k")
j = F("j")
l = D("l")

h.x = k
g.z = j
e.y = k
e.r = i
e.v = g
i.w = l
i.x = h
i.p = j
i.o = e
k.y = h
k.z = h
k.p = e
k.u = e
k.x = j
j.w = g
j.x = k
j.q = e
j.u = e
l.w = i
l.x = h
l.p = j
l.o = e
assert g.z.u.r.p.w.z.q.txt == "e"