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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: E = None
        self.q: F = None
        self.s: E = None
        self.v: A = None
        self.o: A = None
        self.txt = txt

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

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

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

l = A("l")
n = B("n")
k = C("k")
g = D("g")
d = E("d")
e = F("e")

l.y = g
l.v = n
n.t = l
k.w = n
k.r = d
k.s = d
k.q = e
k.v = l
k.o = l
g.x = l
g.s = l
g.p = n
d.r = e
e.w = l
e.u = n
e.y = n
e.o = n
assert d.r.y.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: E = None
        self.q: F = None
        self.s: E = None
        self.v: A = None
        self.o: A = None
        self.txt = txt

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

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

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

l = A("l")
n = B("n")
k = C("k")
g = D("g")
d = E("d")
e = F("e")

l.y = g
l.v = n
n.t = l
k.w = n
k.r = d
k.s = d
k.q = e
k.v = l
k.o = l
g.x = l
g.s = l
g.p = n
d.r = e
e.w = l
e.u = n
e.y = n
e.o = n
assert d.r.y.t.y.txt == "g"