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

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

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

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

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

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

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

c.r = a
j.r = a
k.p = a
k.r = h
k.s = j
k.y = c
h.o = m
h.u = e
e.o = c
e.r = j
a.z = h
a.r = k
a.v = c
m.o = c
m.r = j
assert c.r.r.y.r.v.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

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

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

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

c.r = a
j.r = a
k.p = a
k.r = h
k.s = j
k.y = c
h.o = m
h.u = e
e.o = c
e.r = j
a.z = h
a.r = k
a.v = c
m.o = c
m.r = j
assert c.r.r.y.r.v.r.r.txt == "k"