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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: A = None
        self.y: E = None
        self.v: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: A = None
        self.y: E = None
        self.v: D = None
        self.s: D = None
        self.txt = txt

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

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