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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: F = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
k = C("k")
j = D("j")
e = E("e")
b = F("b")

m.r = h
m.y = k
h.s = e
k.u = e
k.w = b
j.z = h
j.t = b
j.y = m
e.v = k
e.o = k
e.p = b
b.o = h
b.t = h
b.y = e
assert m.r.s.o.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: F = None
        self.txt = txt

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

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

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

m = A("m")
h = B("h")
k = C("k")
j = D("j")
e = E("e")
b = F("b")

m.r = h
m.y = k
h.s = e
k.u = e
k.w = b
j.z = h
j.t = b
j.y = m
e.v = k
e.o = k
e.p = b
b.o = h
b.t = h
b.y = e
assert m.r.s.o.w.t.txt == "h"