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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: F = None
        self.t: E = None
        self.r: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.q: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: B = None
        self.txt = txt

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

l.y = j
b.y = j
b.t = j
b.v = n
b.r = l
e.q = l
e.p = j
a.w = m
a.q = j
j.q = a
m.z = e
m.s = b
n.z = e
n.s = b
assert n.z.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: F = None
        self.t: E = None
        self.r: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.q: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: B = None
        self.txt = txt

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

l.y = j
b.y = j
b.t = j
b.v = n
b.r = l
e.q = l
e.p = j
a.w = m
a.q = j
j.q = a
m.z = e
m.s = b
n.z = e
n.s = b
assert n.z.q.y.txt == "j"