class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

f.x = g
b.v = n
b.w = n
a.r = i
g.z = e
g.r = e
g.o = e
g.x = i
g.q = n
n.t = i
n.x = i
n.s = b
n.p = b
e.p = a
e.z = b
m.x = g
l.x = g
i.r = a
assert n.p.v.p.txt == "b"