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

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: D = None
        self.w: C = None
        self.txt = txt

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

b = A("b")
c = B("c")
h = C("h")
g = D("g")
k = C("k")
d = A("d")
i = B("i")

b.s = k
b.t = k
b.u = k
c.t = k
c.u = d
h.z = i
h.t = g
h.w = k
g.q = h
g.x = b
k.z = i
k.t = g
k.w = h
d.s = k
d.t = k
d.u = h
i.t = h
i.u = d
assert k.z.u.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.t: C = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: D = None
        self.w: C = None
        self.txt = txt

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

b = A("b")
c = B("c")
h = C("h")
g = D("g")
k = C("k")
d = A("d")
i = B("i")

b.s = k
b.t = k
b.u = k
c.t = k
c.u = d
h.z = i
h.t = g
h.w = k
g.q = h
g.x = b
k.z = i
k.t = g
k.w = h
d.s = k
d.t = k
d.u = h
i.t = h
i.u = d
assert k.z.u.u.t.txt == "g"