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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: B = None
        self.o: E = None
        self.txt = txt

d = A("d")
f = B("f")
a = C("a")
h = D("h")
b = E("b")
g = F("g")

d.x = a
d.s = a
d.t = a
d.r = f
f.u = h
f.q = g
f.t = d
a.o = f
a.s = b
h.v = b
h.x = f
b.r = h
b.u = a
b.s = f
g.u = b
g.o = b
g.y = f
assert a.o.q.u.r.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: B = None
        self.s: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: B = None
        self.o: E = None
        self.txt = txt

d = A("d")
f = B("f")
a = C("a")
h = D("h")
b = E("b")
g = F("g")

d.x = a
d.s = a
d.t = a
d.r = f
f.u = h
f.q = g
f.t = d
a.o = f
a.s = b
h.v = b
h.x = f
b.r = h
b.u = a
b.s = f
g.u = b
g.o = b
g.y = f
assert a.o.q.u.r.x.t.txt == "d"