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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

l = A("l")
f = B("f")
d = C("d")
i = D("i")
j = E("j")
b = F("b")
m = G("m")

l.t = f
l.x = i
l.y = b
l.w = j
f.x = l
f.w = l
d.o = b
d.z = f
d.x = j
i.v = j
j.o = l
b.v = m
m.o = l
assert i.v.o.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: D = None
        self.y: F = None
        self.w: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

l = A("l")
f = B("f")
d = C("d")
i = D("i")
j = E("j")
b = F("b")
m = G("m")

l.t = f
l.x = i
l.y = b
l.w = j
f.x = l
f.w = l
d.o = b
d.z = f
d.x = j
i.v = j
j.o = l
b.v = m
m.o = l
assert i.v.o.x.v.txt == "j"