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

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

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

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

m.w = h
m.y = j
f.z = l
f.r = l
f.o = m
c.p = a
c.r = b
j.z = h
j.o = h
d.o = b
d.v = f
l.o = b
a.p = c
a.r = m
h.z = j
h.o = j
k.z = l
k.r = l
k.o = b
b.w = j
b.y = h
assert j.o.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

m.w = h
m.y = j
f.z = l
f.r = l
f.o = m
c.p = a
c.r = b
j.z = h
j.o = h
d.o = b
d.v = f
l.o = b
a.p = c
a.r = m
h.z = j
h.o = j
k.z = l
k.r = l
k.o = b
b.w = j
b.y = h
assert j.o.z.o.z.txt == "j"