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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: E = None
        self.s: F = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: E = None
        self.s: F = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

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