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

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

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

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

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

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

b = A("b")
n = B("n")
l = C("l")
h = D("h")
e = E("e")
g = F("g")

b.o = g
b.z = n
n.v = l
n.y = l
l.u = e
h.x = e
h.u = l
e.y = g
e.x = l
g.y = l
g.x = e
assert e.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

b = A("b")
n = B("n")
l = C("l")
h = D("h")
e = E("e")
g = F("g")

b.o = g
b.z = n
n.v = l
n.y = l
l.u = e
h.x = e
h.u = l
e.y = g
e.x = l
g.y = l
g.x = e
assert e.x.u.x.txt == "l"