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

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

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

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

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

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

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

b.r = f
d.z = g
d.t = b
f.z = a
f.q = a
f.r = d
f.y = d
n.u = f
n.o = g
n.p = b
n.y = l
a.v = g
a.r = d
a.q = b
a.t = f
a.u = f
a.s = l
g.o = f
l.z = a
l.q = a
l.r = d
l.y = d
assert g.o.y.t.r.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

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

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

b.r = f
d.z = g
d.t = b
f.z = a
f.q = a
f.r = d
f.y = d
n.u = f
n.o = g
n.p = b
n.y = l
a.v = g
a.r = d
a.q = b
a.t = f
a.u = f
a.s = l
g.o = f
l.z = a
l.q = a
l.r = d
l.y = d
assert g.o.y.t.r.y.z.txt == "g"