class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: G = None
        self.o: G = None
        self.p: E = None
        self.t: G = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.r: G = None
        self.t: E = None
        self.txt = txt

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

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

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

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

h = A("h")
a = B("a")
m = C("m")
b = D("b")
n = E("n")
l = F("l")
d = G("d")

h.y = a
h.x = d
h.o = d
h.t = d
h.p = n
h.r = m
a.w = n
a.o = n
a.z = b
a.x = l
m.v = d
m.r = d
m.t = n
b.t = n
n.t = b
l.v = a
d.t = a
d.r = a
d.w = h
assert a.x.v.x.v.x.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: G = None
        self.o: G = None
        self.p: E = None
        self.t: G = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: G = None
        self.r: G = None
        self.t: E = None
        self.txt = txt

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

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

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

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

h = A("h")
a = B("a")
m = C("m")
b = D("b")
n = E("n")
l = F("l")
d = G("d")

h.y = a
h.x = d
h.o = d
h.t = d
h.p = n
h.r = m
a.w = n
a.o = n
a.z = b
a.x = l
m.v = d
m.r = d
m.t = n
b.t = n
n.t = b
l.v = a
d.t = a
d.r = a
d.w = h
assert a.x.v.x.v.x.v.x.txt == "l"