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

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

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

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

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

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

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

l.s = j
l.q = e
j.q = e
j.s = n
j.y = l
m.v = e
m.o = d
d.v = l
d.p = l
d.w = j
n.t = j
n.y = m
e.o = m
e.p = l
assert n.y.v.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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

l.s = j
l.q = e
j.q = e
j.s = n
j.y = l
m.v = e
m.o = d
d.v = l
d.p = l
d.w = j
n.t = j
n.y = m
e.o = m
e.p = l
assert n.y.v.o.o.txt == "d"