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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: D = None
        self.q: C = None
        self.o: D = None
        self.y: B = None
        self.txt = txt

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

f = A("f")
k = B("k")
n = C("n")
d = D("d")
a = E("a")
l = F("l")
c = E("c")

f.r = k
k.z = f
k.o = f
k.x = c
k.t = l
n.r = k
n.y = l
d.r = l
d.s = k
a.x = c
a.t = d
a.o = d
a.q = n
a.y = k
l.w = d
l.o = d
l.v = n
l.p = n
c.x = a
c.t = d
c.o = d
c.q = n
c.y = k
assert f.r.t.v.r.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: E = None
        self.t: D = None
        self.q: C = None
        self.o: D = None
        self.y: B = None
        self.txt = txt

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

f = A("f")
k = B("k")
n = C("n")
d = D("d")
a = E("a")
l = F("l")
c = E("c")

f.r = k
k.z = f
k.o = f
k.x = c
k.t = l
n.r = k
n.y = l
d.r = l
d.s = k
a.x = c
a.t = d
a.o = d
a.q = n
a.y = k
l.w = d
l.o = d
l.v = n
l.p = n
c.x = a
c.t = d
c.o = d
c.q = n
c.y = k
assert f.r.t.v.r.t.w.txt == "d"