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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: F = None
        self.w: B = None
        self.q: C = None
        self.txt = txt

d = A("d")
b = B("b")
f = C("f")
g = D("g")
k = E("k")
j = F("j")
c = B("c")
i = C("i")
e = F("e")
h = E("h")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: F = None
        self.w: B = None
        self.q: C = None
        self.txt = txt

d = A("d")
b = B("b")
f = C("f")
g = D("g")
k = E("k")
j = F("j")
c = B("c")
i = C("i")
e = F("e")
h = E("h")

d.o = g
d.u = i
b.z = g
b.o = f
f.q = b
g.v = f
g.x = c
k.r = d
k.w = c
j.t = e
j.r = e
j.w = c
j.q = f
c.z = g
c.o = i
i.q = b
e.t = j
e.r = j
e.w = b
e.q = f
h.r = d
h.w = c
assert c.o.q.o.q.o.q.o.q.z.txt == "g"