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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: F = None
        self.txt = txt

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

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

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