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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

j = A("j")
h = B("h")
e = C("e")
f = D("f")
m = E("m")
d = F("d")

j.s = e
j.q = f
j.t = m
h.p = f
h.y = f
e.r = d
e.u = f
f.v = d
f.o = j
m.x = h
m.r = e
d.x = f
d.o = j
assert d.o.s.r.o.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: D = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

j = A("j")
h = B("h")
e = C("e")
f = D("f")
m = E("m")
d = F("d")

j.s = e
j.q = f
j.t = m
h.p = f
h.y = f
e.r = d
e.u = f
f.v = d
f.o = j
m.x = h
m.r = e
d.x = f
d.o = j
assert d.o.s.r.o.s.u.txt == "f"