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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: B = None
        self.p: D = None
        self.t: D = None
        self.txt = txt

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

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

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

g.u = d
g.t = d
g.q = c
f.r = g
f.o = m
f.p = c
f.t = c
h.o = c
c.q = d
k.o = c
i.u = g
i.t = g
i.q = c
m.r = d
m.o = f
m.p = c
m.t = c
d.u = g
d.t = i
d.q = c
assert i.q.q.u.u.q.q.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: A = None
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: B = None
        self.p: D = None
        self.t: D = None
        self.txt = txt

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

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

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

g.u = d
g.t = d
g.q = c
f.r = g
f.o = m
f.p = c
f.t = c
h.o = c
c.q = d
k.o = c
i.u = g
i.t = g
i.q = c
m.r = d
m.o = f
m.p = c
m.t = c
d.u = g
d.t = i
d.q = c
assert i.q.q.u.u.q.q.t.u.txt == "g"