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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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