class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: D = None
        self.u: B = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: D = None
        self.p: D = None
        self.q: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: B = None
        self.u: B = None
        self.txt = txt

e = A("e")
d = B("d")
f = C("f")
k = D("k")
c = A("c")
g = C("g")
h = B("h")

e.t = c
e.x = k
e.u = d
e.z = h
d.u = e
d.s = k
d.p = k
d.q = h
f.u = g
f.q = k
k.v = d
k.z = d
k.u = d
c.t = e
c.x = k
c.u = h
c.z = h
g.u = f
g.q = k
h.u = c
h.s = k
h.p = k
h.q = d
assert d.q.u.x.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: D = None
        self.u: B = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: D = None
        self.p: D = None
        self.q: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: B = None
        self.u: B = None
        self.txt = txt

e = A("e")
d = B("d")
f = C("f")
k = D("k")
c = A("c")
g = C("g")
h = B("h")

e.t = c
e.x = k
e.u = d
e.z = h
d.u = e
d.s = k
d.p = k
d.q = h
f.u = g
f.q = k
k.v = d
k.z = d
k.u = d
c.t = e
c.x = k
c.u = h
c.z = h
g.u = f
g.q = k
h.u = c
h.s = k
h.p = k
h.q = d
assert d.q.u.x.u.q.txt == "h"