class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: D = None
        self.z: E = None
        self.p: C = None
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: E = None
        self.z: A = None
        self.p: A = None
        self.w: E = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: E = None
        self.w: C = None
        self.txt = txt

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

b = A("b")
d = B("d")
f = C("f")
k = D("k")
e = E("e")
a = F("a")
n = E("n")
g = D("g")
i = C("i")

b.r = d
b.o = g
b.z = e
b.p = f
b.v = n
d.y = i
d.x = b
f.q = i
k.x = f
k.q = e
k.z = b
k.p = b
k.w = n
k.o = d
e.t = b
e.y = n
e.w = i
a.r = d
n.t = b
n.y = e
n.w = i
g.x = i
g.q = e
g.w = e
g.z = b
g.p = b
g.o = d
i.q = f
assert a.r.y.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: D = None
        self.z: E = None
        self.p: C = None
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: E = None
        self.z: A = None
        self.p: A = None
        self.w: E = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: E = None
        self.w: C = None
        self.txt = txt

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

b = A("b")
d = B("d")
f = C("f")
k = D("k")
e = E("e")
a = F("a")
n = E("n")
g = D("g")
i = C("i")

b.r = d
b.o = g
b.z = e
b.p = f
b.v = n
d.y = i
d.x = b
f.q = i
k.x = f
k.q = e
k.z = b
k.p = b
k.w = n
k.o = d
e.t = b
e.y = n
e.w = i
a.r = d
n.t = b
n.y = e
n.w = i
g.x = i
g.q = e
g.w = e
g.z = b
g.p = b
g.o = d
i.q = f
assert a.r.y.q.q.q.q.q.txt == "f"