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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.s: F = None
        self.t: C = None
        self.y: F = None
        self.x: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: D = None
        self.v: C = None
        self.txt = txt

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

l.p = i
l.z = k
l.v = n
g.q = i
g.o = i
g.t = l
i.u = l
i.v = l
k.o = g
k.v = g
k.s = b
k.y = b
k.x = b
k.t = i
n.y = b
n.t = b
n.p = i
b.z = i
b.v = i
b.r = k
j.q = i
j.o = i
j.t = l
assert b.z.v.z.v.t.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: D = None
        self.v: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.s: F = None
        self.t: C = None
        self.y: F = None
        self.x: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: D = None
        self.v: C = None
        self.txt = txt

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

l.p = i
l.z = k
l.v = n
g.q = i
g.o = i
g.t = l
i.u = l
i.v = l
k.o = g
k.v = g
k.s = b
k.y = b
k.x = b
k.t = i
n.y = b
n.t = b
n.p = i
b.z = i
b.v = i
b.r = k
j.q = i
j.o = i
j.t = l
assert b.z.v.z.v.t.p.v.txt == "l"