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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: C = None
        self.q: F = None
        self.r: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

l = A("l")
m = B("m")
a = C("a")
k = D("k")
b = E("b")
j = F("j")

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: C = None
        self.q: F = None
        self.r: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

l = A("l")
m = B("m")
a = C("a")
k = D("k")
b = E("b")
j = F("j")

l.w = b
m.w = a
m.o = a
m.y = a
m.q = j
m.r = j
a.t = l
a.z = m
k.o = j
k.r = j
k.v = b
b.s = j
b.y = a
b.t = a
b.z = m
j.r = m
assert j.r.w.t.w.t.z.txt == "m"