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

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

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

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

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

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

l = A("l")
j = B("j")
a = C("a")
e = D("e")
k = E("k")
n = F("n")

l.r = a
j.t = e
j.q = e
j.s = e
j.y = e
a.w = n
a.v = n
a.s = e
a.o = l
e.q = n
e.v = n
e.o = l
e.p = j
k.r = j
n.z = e
n.y = a
assert a.o.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

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

l = A("l")
j = B("j")
a = C("a")
e = D("e")
k = E("k")
n = F("n")

l.r = a
j.t = e
j.q = e
j.s = e
j.y = e
a.w = n
a.v = n
a.s = e
a.o = l
e.q = n
e.v = n
e.o = l
e.p = j
k.r = j
n.z = e
n.y = a
assert a.o.r.o.txt == "l"