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

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: F = None
        self.s: E = None
        self.t: F = None
        self.y: E = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: D = None
        self.o: F = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

f = A("f")
b = B("b")
h = C("h")
n = D("n")
d = E("d")
j = F("j")
m = E("m")

f.x = j
f.t = j
f.u = n
b.z = j
b.u = j
b.q = f
b.s = n
b.p = h
b.o = h
h.p = j
n.o = d
n.v = j
n.t = j
n.s = m
n.y = m
n.r = b
d.y = m
d.r = n
d.o = j
d.t = b
j.r = m
m.y = d
m.r = n
m.o = j
m.t = b
assert f.u.r.q.x.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.u: D = None
        self.t: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: F = None
        self.s: E = None
        self.t: F = None
        self.y: E = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: D = None
        self.o: F = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

f = A("f")
b = B("b")
h = C("h")
n = D("n")
d = E("d")
j = F("j")
m = E("m")

f.x = j
f.t = j
f.u = n
b.z = j
b.u = j
b.q = f
b.s = n
b.p = h
b.o = h
h.p = j
n.o = d
n.v = j
n.t = j
n.s = m
n.y = m
n.r = b
d.y = m
d.r = n
d.o = j
d.t = b
j.r = m
m.y = d
m.r = n
m.o = j
m.t = b
assert f.u.r.q.x.r.t.txt == "b"