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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: B = None
        self.q: D = None
        self.o: E = None
        self.p: D = None
        self.txt = txt

b = A("b")
n = B("n")
j = C("j")
f = D("f")
m = E("m")
l = F("l")
k = F("k")
e = E("e")

b.r = n
n.x = m
j.v = n
j.s = n
j.u = e
f.v = e
m.y = l
m.z = b
m.x = b
l.t = n
l.v = n
l.q = f
l.p = f
l.o = m
k.t = n
k.v = n
k.q = f
k.p = f
k.o = m
e.y = k
e.z = b
e.x = b
assert l.p.v.y.v.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: B = None
        self.q: D = None
        self.o: E = None
        self.p: D = None
        self.txt = txt

b = A("b")
n = B("n")
j = C("j")
f = D("f")
m = E("m")
l = F("l")
k = F("k")
e = E("e")

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