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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: D = None
        self.p: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: D = None
        self.u: A = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

g = A("g")
m = B("m")
c = C("c")
b = D("b")
d = E("d")
f = F("f")
l = B("l")

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: D = None
        self.p: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: D = None
        self.u: A = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

g = A("g")
m = B("m")
c = C("c")
b = D("b")
d = E("d")
f = F("f")
l = B("l")

g.v = f
g.y = c
m.q = g
m.p = g
m.t = b
c.z = f
c.y = f
c.r = f
c.x = d
c.q = d
c.t = d
b.o = c
d.x = g
d.u = g
d.t = b
d.p = c
d.o = c
f.p = d
f.z = c
l.q = g
l.p = g
l.t = b
assert m.t.o.y.p.u.v.p.txt == "d"