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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: C = None
        self.u: A = None
        self.v: A = None
        self.q: C = None
        self.txt = txt

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

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

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

l = A("l")
f = B("f")
b = C("b")
d = D("d")
j = E("j")
n = F("n")
g = C("g")

l.v = f
l.q = j
l.r = g
l.s = n
f.x = n
b.y = d
b.p = g
b.q = g
b.u = l
b.v = l
d.w = l
j.t = n
j.r = n
j.s = l
n.p = g
n.x = l
g.y = d
g.p = b
g.q = b
g.u = l
g.v = l
assert d.w.r.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: E = None
        self.r: C = None
        self.s: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.p: C = None
        self.u: A = None
        self.v: A = None
        self.q: C = None
        self.txt = txt

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

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

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

l = A("l")
f = B("f")
b = C("b")
d = D("d")
j = E("j")
n = F("n")
g = C("g")

l.v = f
l.q = j
l.r = g
l.s = n
f.x = n
b.y = d
b.p = g
b.q = g
b.u = l
b.v = l
d.w = l
j.t = n
j.r = n
j.s = l
n.p = g
n.x = l
g.y = d
g.p = b
g.q = b
g.u = l
g.v = l
assert d.w.r.y.w.txt == "l"