class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: F = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: A = None
        self.o: B = None
        self.r: C = None
        self.u: F = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: A = None
        self.z: B = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

f = A("f")
l = B("l")
i = C("i")
m = D("m")
a = E("a")
h = F("h")
g = B("g")
e = F("e")

f.q = i
f.p = i
f.y = e
l.y = a
i.t = h
m.y = h
m.u = h
m.x = f
m.o = g
m.q = g
m.r = i
a.v = e
a.q = f
a.z = l
a.t = h
h.p = i
g.y = a
e.p = i
assert i.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: F = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.x: A = None
        self.o: B = None
        self.r: C = None
        self.u: F = None
        self.q: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.q: A = None
        self.z: B = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

f = A("f")
l = B("l")
i = C("i")
m = D("m")
a = E("a")
h = F("h")
g = B("g")
e = F("e")

f.q = i
f.p = i
f.y = e
l.y = a
i.t = h
m.y = h
m.u = h
m.x = f
m.o = g
m.q = g
m.r = i
a.v = e
a.q = f
a.z = l
a.t = h
h.p = i
g.y = a
e.p = i
assert i.t.p.t.txt == "h"