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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

a.x = d
a.y = l
d.y = j
d.u = l
d.x = l
d.s = f
d.w = b
j.x = e
j.u = l
l.w = f
e.p = b
e.y = l
e.q = l
f.q = e
f.y = e
f.x = a
f.p = d
f.v = d
f.s = l
b.x = d
b.y = l
assert f.p.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.u: D = None
        self.txt = txt

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

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

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

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

a.x = d
a.y = l
d.y = j
d.u = l
d.x = l
d.s = f
d.w = b
j.x = e
j.u = l
l.w = f
e.p = b
e.y = l
e.q = l
f.q = e
f.y = e
f.x = a
f.p = d
f.v = d
f.s = l
b.x = d
b.y = l
assert f.p.s.x.txt == "a"