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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: B = None
        self.u: D = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: B = None
        self.u: C = None
        self.txt = txt

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

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

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

l.r = j
m.w = d
d.y = k
d.o = m
d.u = c
d.x = h
c.t = j
c.v = m
c.u = d
k.r = c
k.t = c
k.y = m
k.q = m
k.z = l
j.z = k
h.r = c
h.t = c
h.y = m
h.q = m
h.z = l
assert j.z.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: B = None
        self.u: D = None
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: B = None
        self.u: C = None
        self.txt = txt

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

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

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

l.r = j
m.w = d
d.y = k
d.o = m
d.u = c
d.x = h
c.t = j
c.v = m
c.u = d
k.r = c
k.t = c
k.y = m
k.q = m
k.z = l
j.z = k
h.r = c
h.t = c
h.y = m
h.q = m
h.z = l
assert j.z.y.w.txt == "d"