class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: C = None
        self.p: C = None
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.txt = txt

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

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

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

h = A("h")
n = B("n")
b = C("b")
a = D("a")
d = E("d")
l = F("l")
i = A("i")
j = C("j")

h.z = n
h.q = b
h.p = b
h.u = d
n.y = h
b.r = a
b.x = a
a.v = l
a.q = l
a.o = b
d.o = i
d.v = j
l.r = a
i.z = n
i.q = j
i.p = j
i.u = d
j.r = a
j.x = a
assert i.z.y.u.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.q: C = None
        self.p: C = None
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.txt = txt

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

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

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

h = A("h")
n = B("n")
b = C("b")
a = D("a")
d = E("d")
l = F("l")
i = A("i")
j = C("j")

h.z = n
h.q = b
h.p = b
h.u = d
n.y = h
b.r = a
b.x = a
a.v = l
a.q = l
a.o = b
d.o = i
d.v = j
l.r = a
i.z = n
i.q = j
i.p = j
i.u = d
j.r = a
j.x = a
assert i.z.y.u.o.p.txt == "j"