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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.r: D = None
        self.txt = txt

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

b.u = j
b.v = c
c.s = b
c.t = m
l.w = c
m.r = b
m.s = c
m.x = c
j.r = b
j.t = m
j.u = l
j.x = l
a.v = b
a.u = b
a.r = m
assert j.r.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.r: D = None
        self.txt = txt

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

b.u = j
b.v = c
c.s = b
c.t = m
l.w = c
m.r = b
m.s = c
m.x = c
j.r = b
j.t = m
j.u = l
j.x = l
a.v = b
a.u = b
a.r = m
assert j.r.u.x.txt == "l"